﻿<%@ Page Title="" Language="C#" MasterPageFile="~/SiteJN.Master" AutoEventWireup="true" CodeBehind="ListPicData.aspx.cs" Inherits="jnagr.Web.weatherinfo.ListPicData" %>
<%@ Register Src="~/Controls/checkright.ascx" TagPrefix="uc1" TagName="checkright" %>
<%@ Register Src="~/Controls/spet.ascx" TagPrefix="uc1" TagName="spet" %>
<%@ Register Src="~/Controls/copyright.ascx" TagPrefix="uc1" TagName="copyright" %>


<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script src="../Script/intense.js"></script>
    <link href="../CSS/zzsc.css" rel="stylesheet" />
    <style >
        .mypic {
            margin:2px;
            float:left;
        }
        .ptime {
            text-align:center;
        }
        #ProductShow{width:100%;height:auto;text-align:center;border:1px solid #c0c0c0;margin:5px;}
        #CSSBox{width:100%;height:140px; border:1px solid #000000; margin:0 auto;overflow-x:auto;background-color:#ffffff;}
#CSSBox ul li{ float:left; list-style:none; border:0px solid red; margin:2px;}
#CSSBox ul li span{ display:block; text-align:center; font-size:12px;}


    </style>
    <script src="../Script/json2.js"></script>
    <script type="text/javascript">
        var sprovince = "";
        var scity = "";
        var scounty = "";
        var areas = "";
        var se = "";
        var sebm = "";
        var getdata = "";
        var level;
        var markerClusterer;
        var markers = [];
        var devid;
        var uid = '';
        var qh = '';
        var map;
        var data_info;
        var opts;
        var dtOpstart;
        var dtOpend;
        var pt;
        var iscollect;
        var pSize =3;
        var count = 0;
        var picname = "";
        var ybqid = "";
        var ybqch = "";
        var datagridpic;
        var wchartInstance;
        $(function () {
            curmenu('靶标图像识别');
            
            $.ajax({
                type: "post",
                dataType: "json",
                url: "../admin/getinfo.ashx?action=level",
                success: function aa(data) {
                    sprovince = data[0].province;
                    scity = data[0].city;
                    scounty = data[0].county;
                    InitTree();
                    InitMap();
                }
            });
            
            $("#tab").tabs({
                onSelect: function (title, index) {
                    //if (index == '2')
                    //{
                    //    hz();
                    //}
                }
            });

        });
        
        function InitMapmark() {
            $('#win').datagrid({
                //title: '测报点列表', //表格标题
                url: '../devinfo/GetDev.ashx', //请求数据的页面
                sortName: 'mname', //排序字段
                idField: 'mid', //标识字段,主键
                iconCls: '', //标题左边的图标
                width: '95%', //宽度
                height: '95%', //高度
                nowrap: false, //是否换行，True 就会把数据显示在一行里
                striped: true, //True 奇偶行使用不同背景色
                collapsible: false, //可折叠
                sortOrder: 'desc', //排序类型
                remoteSort: true, //定义是否从服务器给数据排序
                fitColumns: true,
                singleSelect: true,
                method: 'post',
                columns: [[
	                { title: '测报站名', field: 'mname', width: 80, sortable: true }
                ]],
                toolbar: "#tab_toolbar",
                queryParams: { "action": "querydev", "dtype": "PICSB" },
                pageNumber: 1, //默认索引页
                pageSize: 500, //默认一页数据条数
                rownumbers: true, //行号
                pageList: [10, 20, 50, 200, 500],
                pagination: false, //是否开启分页                
                onLoadSuccess: function (data) {
                    data_info = [];
                    getdata = data;
                    map.clearOverlays();
                    $.each(data.rows, function (k, v) {
                        data_info.push({ "lng": v["mjd"], "lat": v["mwd"], "mlevel": v["DevType"], "mname": v["devname"], "madd": v["DevLocation"], "mpic": v["mpic"], "devid": v["DevID"] });
                    });
                    var mlevel;
                    var marker;
                    var ptt = "";
                    if (markers.length > 0) {
                        if (markerClusterer != null) {
                            markerClusterer.removeMarkers(markers);
                            markerClusterer = null;
                        }
                        markers = [];
                    }
                    for (var i = 0; i < data_info.length; i++) {
                        mlevel = data_info[i].mlevel;
                        ptt = new BMap.Point(data_info[i].lng, data_info[i].lat);
                        if (mlevel == 'CBD')
                            marker = new BMap.Marker(ptt, { icon: icon4 });
                        else if (mlevel == 'YBQ')
                            marker = new BMap.Marker(ptt, { icon: icon3 });
                        else if (mlevel == 'XQH')
                            marker = new BMap.Marker(ptt, { icon: icon2 });
                        else
                            marker = new BMap.Marker(ptt, { icon: icon1 });

                        var did = data_info[i].devid;                        
                        map.addOverlay(marker);                       
                        label = new BMap.Label(data_info[i].mname, { offset: new BMap.Size(20, -10) });
                        marker.setLabel(label);
                        markers.push(marker);
                        addClickHandler(did, marker);
                    }
                    if (markers.length > 0)
                        markerClusterer = new BMapLib.MarkerClusterer(map, { markers: markers });//对地图扩大缩小后会都所有的点全显示出来。
                    if (scounty != "")
                        map.centerAndZoom(scounty, 12);
                    else if (scity != "")
                        map.centerAndZoom(scity, 10);
                    else if (sprovince != "")
                        map.centerAndZoom(sprovince, 8);
                    else
                        map.centerAndZoom("西安", 5);
                    if (areas != "")
                        getBoundary(areas);
                    renderstation();
                }
            });
        }
        function addClickHandler(did, marker) {
            marker.addEventListener("click", function (e) {
                $.ajax({
                    type: "post",
                    dataType: "json",
                    url: "../devinfo/GetDev.ashx?action=queryxqh&devid=" + did,
                    success: function aa(data) {
                        ybqid = data[0].ybqid;
                        ybqch = data[0].ybqch;
                        showawsinfectInfo(did);
                    }
                });
                
            }
            );
        }
        function InitTree() {
            $('#pt').tree({
                width: '100%', //宽度 
                lines: true,
                //data: provincetree,   
                url: '../areainfo/GetArea.ashx', //请求数据的页面 
                method: 'post',
                queryParams: { "action": "querymyareauser" },
                onBeforeExpand: function (node) {
                    $("#pt").tree("options").queryParams = { "action": "queryyb" };
                    $('#pt').tree('options').url = "../areainfo/GetArea.ashx?pid=" + node.id;
                },
                onClick: function (node) {
                    if (node.text != "") {
                        sebm = node.bm;
                        //获取地区全称
                        if (sebm == "0")
                            areas = "";
                        else if (sebm.length == 6 && sebm.indexOf("0000")) {
                            areas = node.text;
                        }
                        else {
                            var result = $.ajax({
                                url: "../areainfo/GetArea.ashx?action=queryarea",
                                type: 'post',
                                dataType: 'json',
                                async: false,
                                cache: false
                            }).responseText;
                            areas = result;
                        }
                        reloadgridTree();
                    }

                },
                onLoadSuccess: function (node, param) {

                }
            });
           
        }
        function showawsinfectInfo(id) {
            devid = id;
            
            addTab(devid, 'mypicdata.html');
        }

        var phone = 0;
        var chs;
        var mpet = "";
        var mpetv = "";
        var griddata = "";
        var cadd = "";        
        var filterObj = "";
        var add = "";
        var uname = "";
        var qxchs;
       
        function getids(rows) {
            var ids = "";
            for (var i = 0; i < rows.length; i++)
                ids = ids + rows[i].uid + ",";
            if (ids != "")
                ids = ids.substr(0, ids.length - 1);
            return ids;

        }       
        function sendmsg() {
            var rows = $('#suser').datagrid('getSelections');
            if (rows == null || rows.length == 0) {
                $.messager.alert("提示", "请选择要设置的行！", "info");
                return;
            }
            if (rows) {
                $.messager.confirm('提示', '你确定要发送吗？', function (r) {
                    if (r) {
                        var uids = getids(rows);
                        var msg = $('#yjfx').text();
                        var title = "预警提醒";
                        $('#fm').form('submit', {
                            url: "../info/getinfo.ashx?action=adds&title=" + title + "&uid=" + uids + "&infocontent=" + msg,
                            onSubmit: function () {
                                return $(this).form('validate');
                            },
                            success: function (result) {
                                if (result.indexOf("T") == 0) {
                                    $('#dlg').dialog('open').dialog('close');
                                    $.messager.alert("提示", "恭喜您，信息发送成功", "info");
                                }
                                else if ((result.indexOf("F") == 0)) {
                                    $.messager.alert("提示", "发送失败，请重新操作！", "info");
                                    return;
                                }
                                else if ((result.indexOf("L") == 0)) {
                                    $.messager.alert("提示", "长时间没有操作，请重新登录！", "info");
                                    top.location = '/index.aspx';
                                    return;
                                }
                            }
                        });

                    }
                })
            }

        }

        function getUrlParam(name) {
            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
            var r = window.location.search.substr(1).match(reg);  //匹配目标参数
            if (r != null) return unescape(r[2]); return null; //返回参数值
        }
        function InitGird() {
            $('#ptstr').val(picname);
            var h = $("#my1").height()-60;
            var w = $("#my1").width()-630;
            $('#zddate').datagrid({
                title: picname, //表格标题
                url: 'GetPicData.ashx', //请求数据的页面
                sortName: 'ptime', //排序字段
                idField: 'pid', //标识字段,主键
                iconCls: '', //标题左边的图标
                height: h,
                width: w,
                nowrap: false, //是否换行，True 就会把数据显示在一行里
                striped: true, //True 奇偶行使用不同背景色
                collapsible: false, //可折叠
                sortOrder: 'desc', //排序类型
                remoteSort: true, //定义是否从服务器给数据排序
                fitColumns: true,
                singleSelect: true,
                method: 'post',
                columns: [[//							                    
                   { field: 'ckb', checkbox: true },	                                 
                    { title: '害虫', field: 'pname', width: 100 },
                    { title: '数量', field: 'pnum', width: 50 }                    
                ]
                ],                
                toolbar: "#tab_toolbars",
                queryParams: { "action": "querycz", "ptstr": picname ,"ybqid":ybqid},
                pagination: false, //是否开启分页
                pageNumber: 1, //默认索引页
                pageSize:5, //默认一页数据条数
                rownumbers: true,
                onLoadSuccess: function (data) {
                    datagridpic = data;
                }
            });
            Highcharts.setOptions({
                lang: {
                    contextButtonTitle: "图表导出菜单",
                    decimalPoint: ".",
                    downloadJPEG: "下载JPEG图片",
                    downloadPDF: "下载PDF文件",
                    downloadPNG: "下载PNG文件",
                    downloadSVG: "下载SVG文件",
                    drillUpText: "返回 {series.name}",
                    loading: "加载中",
                    months: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"],
                    noData: "没有数据",
                    numericSymbols: ["千", "兆", "G", "T", "P", "E"],
                    printChart: "打印图表",
                    resetZoom: "恢复缩放",
                    resetZoomTitle: "恢复图表",
                    shortMonths: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
                    thousandsSep: ",",
                    weekdays: ["星期一", "星期二", "星期三", "星期三", "星期四", "星期五", "星期六", "星期天"]
                }
            });

        }
        function newUser() {
            $('#fm').form('clear');            
            $('#dlg').dialog('open').dialog('setTitle', '添加');            
            document.getElementById("test").value = "add";
            $('#ptstr').val(picname);
        }
        //修改管理员  
        function editUser() {
            var row = $('#zddate').datagrid('getSelected');
            if (row == null) {
                $.messager.alert("提示", "请选择要修改的行！", "info");
            }
            if (row) {
                $('#dlg').dialog('open').dialog('setTitle', '修改');                
                document.getElementById("test").value = "modify";                
                $('#fm').form('load', row);               
            }
        }
        //添加        
        function saveUser() {
            var test = document.getElementById("test").value;
            var f = $('#fm');
            if (test == "add") {
                f.form('submit', {
                    url: "GetPicData.ashx?action=" + test,
                    onSubmit: function () {
                        return $(this).form('validate');
                    },
                    success: function (result) {
                        if (result.indexOf("T") == 0) {
                            $('#dlg').dialog('close');
                            $.messager.alert("提示", "恭喜您，信息添加成功", "info");
                            $('#zddate').datagrid('reload');
                        }
                        else if ((result.indexOf("F") == 0)) {
                            $.messager.alert("提示", "添加失败，请重新操作！", "info");
                            return;
                        }
                        else if ((result.indexOf("L") == 0)) {
                            $.messager.alert("提示", "长时间没有操作，请重新登录！", "info");
                            top.location = '/index.aspx';
                            return;
                        }
                    }
                });

            } else {

                $('#fm').form('submit', {
                    url: "GetPicData.ashx?action=" + test,
                    onSubmit: function () {
                        return $(this).form('validate');
                    },
                    success: function (result) {
                        if (result.indexOf("T") == 0) {
                            $('#dlg').dialog('close');
                            $('#zddate').datagrid('clearSelections');
                            $.messager.alert("提示", "恭喜您，信息修改成功", "info");
                            $('#zddate').datagrid('reload');

                        }
                        else if ((result.indexOf("F") == 0)) {
                            $.messager.alert("提示", "添加失败，请重新操作！", "info");
                            return;
                        }
                        else if ((result.indexOf("L") == 0)) {
                            $.messager.alert("提示", "长时间没有操作，请重新登录！", "info");
                            top.location = '/index.aspx';
                            return;
                        }
                    }
                });
            }
        }
        function removeUser() {
            var test = document.getElementById("test").value = "delete";
            var row = $('#zddate').datagrid('getSelected');
            if (row == null) {
                $.messager.alert("提示", "请选择要删除的行！", "info");
            }
            if (row) {
                $.messager.confirm('提示', '你确定要删除这条信息吗？', function (r) {
                    if (r) {
                        $('#fm').form('submit', {
                            url: 'GetPicData.ashx?pdid=' + row.pdid + "&action=" + test,
                            onSubmit: function () {
                                //return $(this).form('validate');  
                            },
                            success: function (result) {
                                if (result.indexOf("T") == 0) {
                                    $('#dlg').dialog('close');
                                    $('#zddate').datagrid('clearSelections'); //清空选中的行  
                                    $.messager.alert("提示", "恭喜您，信息删除成功！", "info");
                                    $('#zddate').datagrid('reload');
                                }
                                else if ((result.indexOf("F") == 0)) {
                                    $.messager.alert("提示", "删除失败，请重新操作！", "info");
                                    return;
                                }
                                else if ((result.indexOf("L") == 0)) {
                                    $.messager.alert("提示", "长时间没有操作，请重新登录！", "info");
                                    top.location = '/index.aspx';
                                    return;
                                }

                            }

                        });
                    }
                })
            }
        }
        function getid(grows) {
            var ids = "";
            for (var i = 0; i < grows.total; i++)
                ids = ids + grows.rows[i].pdid + ",";
            if (ids != "")
                ids = ids.substr(0, ids.length - 1);
            return ids;

        }
        function savejg() {            
            
            if (datagridpic == null) {
                $.messager.alert("提示", "没有任何可更新的行！", "info");
            }
            if (datagridpic) {
                $.messager.confirm('提示', '你确定更新吗？', function (r) {
                    if (r) {
                        var ids = getid(datagridpic);
                        $('#fm').form('submit', {
                            url: 'GetPicData.ashx?ids=' + ids + "&action=updateall&ybqid=" + ybqid + "&ptstr="+picname,
                            onSubmit: function () {
                                //return $(this).form('validate');  
                            },
                            success: function (result) {
                                if (result.indexOf("T") == 0) {
                                    $('#dlg').dialog('close');
                                    $('#zddate').datagrid('clearSelections'); //清空选中的行  
                                    $.messager.alert("提示", "恭喜您，信息更新成功！", "info");
                                    $('#zddate').datagrid('reload');
                                }
                                else if ((result.indexOf("F") == 0)) {
                                    $.messager.alert("提示", "更新失败，没有找到相关数据！", "info");
                                    return;
                                }
                                else if ((result.indexOf("L") == 0)) {
                                    $.messager.alert("提示", "长时间没有操作，请重新登录！", "info");
                                    top.location = '/index.aspx';
                                    return;
                                }

                            }

                        });
                    }
                })
            }
        }
       
        function showxc() {            
            InitSendUser();
            StartTime = $("#StartTime").datebox("getValue");
            EndTime = $("#EndTime").datebox("getValue");
            $.ajax({
                type: "post",
                dataType: "json",
                url: "GetPicData.ashx?action=queryp&rows=" + pSize + "&page=1&sort=ptime&order=desc&bpid=" + devid + "&StartTime=" + StartTime + "&EndTime=" + EndTime,
                success: function aa(data) {
                    count = data.total;
                    renderinfopic(data);
                    $('#pp').pagination({
                        pageSize: pSize,
                        total: count,
                        pageNumber: 1,
                        pageList: [3],
                        onSelectPage: function (pageNumber, pageSize) {
                            StartTime = $("#StartTime").datebox("getValue");
                            EndTime = $("#EndTime").datebox("getValue");
                            $.ajax({
                                type: "post",
                                dataType: "json",
                                url: "GetPicData.ashx?action=queryp&sort=ptime&order=desc&rows=" + pageSize + "&page=" + pageNumber + "&bpid=" + devid + "&StartTime=" + StartTime + "&EndTime=" + EndTime,
                                success: function aa(data) {
                                    renderinfopic(data);
                                }
                            });
                        }
                    });
                }
            });
           
            var sch = ybqch.split(",");
            var mych = "[";            
            $.each(sch, function () {
                if(mych.length>1)
                    mych = mych + ",{pid:'" + this + "',pname:'" + this + "'}";
                else
                    mych = mych + "{pid:'" + this + "',pname:'" + this + "'}";
            });            
            mych = mych + "]";
            $('#pname').combobox({
                data:eval(mych),
                valueField: 'pid',
                textField: 'pname',
                panelHeight: 'auto',
                editable: false,                
            });
            $("#yjfx").panel({
                href: '../html/alarmall.html',
                title: '成虫预警',
                tools: [{ iconCls: 'icon-phone', handler: function () { sendAlarm('虫情预警'); } }],
                onLoad: function () {
                    InitSendUser();
                    $("#btnyj").click(function () {
                        sendAlarm('虫情预警');
                    });
                }

            });
            InitGird();
            var ch0, ch1, ch2, ch3;
            if (sch.length > 0) ch0 = sch[0]; else ch0 = "";
            if (sch.length > 1) ch1 = sch[1]; else ch1 = "";
            if (sch.length > 2) ch2 = sch[2]; else ch2 = "";
            if (sch.length > 3) ch3 = sch[3]; else ch3 = "";
            ChartJS.init(ch0,ch1,ch2,ch3);
            InitGridhw(sch);
        }
        var ChartJS = {
            init: function (ch1, ch2, ch3, ch4) {
                var s = "[";
                if (ch1 != "")
                    s = s + "{name:'" + ch1 + "',data:[]},";
                if (ch2 != "")
                    s = s + "{name:'" + ch2 + "',data:[]},";
                if (ch3 != "")
                    s = s + "{name:'" + ch3 + "',data:[]},";
                if (ch4 != "")
                    s = s + "{name:'" + ch4 + "',data:[]}";
                if (s.substring(s.length - 1, s.length) == ",")
                    s = s.substr(0, s.length - 1);
                s = s + "]";
                wchartInstance = new Highcharts.Chart({
                    chart: {
                        renderTo: 'chartArea',
                        type: 'line'
                    },
                    credits: {
                        enabled: false
                    },
                    exporting: {
                        enabled: true
                    },
                    title: {
                        text: '数据',
                        x: -20 //center
                    },
                    xAxis: {
                        type: 'datetime',
                        labels: {
                            //step: 4,
                            formatter: function () {
                                return new Date(this.value).toLocaleDateString();
                            }
                        }
                    },
                    yAxis: {
                        title: {
                            text: '数量 (只)'
                        },
                        plotLines: [{
                            value: 0,
                            width: 1,
                            color: '#808080'
                        }]
                    },
                    tooltip: {
                        valueSuffix: '只',
                        formatter: function () {
                            return '<b>' + this.series.name + '：</b>' + this.y + '只<br/> <b>时间：</b>' + new Date(this.x).toLocaleString();
                            //return '<b>' + this.series.name + '：</b>' + this.y + '只<br/> <b>时间：</b>' + this.x;
                        }

                    },
                    legend: {
                        layout: 'vertical',
                        align: 'right',
                        verticalAlign: 'middle',
                        borderWidth: 0
                    },
                    series: eval(s)
                });
            }
        };
        function InitGridhw(sch) {
            //var h = $("#gw").height();            
            var avg = "";
            var ch0, ch1, ch2, ch3;
            if (sch.length > 0) ch0 = sch[0]; else ch0 = "";
            if (sch.length > 1) ch1 = sch[1]; else ch1 = "";
            if (sch.length > 2) ch2 = sch[2]; else ch2 = "";
            if (sch.length > 3) ch3 = sch[3]; else ch3 = "";
            var cols = "[[{ title: '设备ID', field: 'devID', width: 100, align: 'center' },"
            if (ch0 != "")
                cols = cols + "{ title:'" + ch0 + "', field: 'ch0', width: 80, align: 'center' },";
            if (ch1 != "")
                cols = cols + "{ title:'" + ch1 + "', field: 'ch1', width: 80, align: 'center' },";
            if (ch2 != "")
                cols = cols + "{ title:'" + ch2 + "', field: 'ch2', width: 80, align: 'center' },";
            if (ch3 != "")
                cols = cols + "{ title:'" + ch3 + "', field: 'ch3', width: 80, align: 'center' },";
            if (avg == "")
                cols = cols + "{ title: '经度', field: 'yjd', width: 150, align: 'center' },{ title: '纬度', field: 'ywd', width: 150, align: 'center' },{ title: '海拔', field: 'yhb', width: 150, align: 'center' },";
            cols = cols + "{ title: '更新时间', field: 'updateTime', width: 150, align: 'center' }]]";
            var chs = sch;
            $('#histList').datagrid({
                toolbar: '#toolbarmhw',
                url: '../devinfo/GetStatus.ashx?action=query&type=YBQ&avg=' + avg,
                title: "靶标数据。",
                iconCls: 'icon icon-list',
                height: '100%',
                width: '100%',
                nowrap: true, //折行
                rownumbers: true, //行号
                striped: true, //隔行变色
                idField: 'keyid', //主键
                singleSelect: true, //单选
                fitColumns: true,
                queryParams: { devID: ybqid, "StartTime": $("#StartTime").datebox("getValue"), "EndTime": $("#EndTime").datebox("getValue") },
                columns: eval(cols),
                pagination: true,
                pageSize: 10,
                onLoadSuccess: function (data) {
                    var mt = "";
                    var md;
                    tc1 = "";
                    tc2 = "";
                    tc3 = "";
                    tc4 = "";
                    $.each(data.rows, function (k, v) {
                        mt = v["updateTime"];
                        mt = mt.replace(/-/g, "/");
                        md = Date.parse(mt);
                        tc1 += "[" + md + "," + v["ch0"] + "],";
                        tc2 += "[" + md + "," + v["ch1"] + "],";
                        tc3 += "[" + md + "," + v["ch2"] + "],";
                        tc4 += "[" + md + "," + v["ch3"] + "],";
                    });
                    tc1 = "[" + tc1 + "]";
                    tc2 = "[" + tc2 + "]";
                    tc3 = "[" + tc3 + "]";
                    tc4 = "[" + tc4 + "]";
                    var n = 0;

                    var num = 0;
                    if (ch0 != "") {
                        wchartInstance.series[n + num].setData(eval(tc1));
                        num = num + 1;
                    }
                    if (ch1 != "") {
                        wchartInstance.series[n + num].setData(eval(tc2));
                        num = num + 1;
                    }
                    if (ch2 != "") {
                        wchartInstance.series[n + num].setData(eval(tc3));
                        num = num + 1;
                    }
                    if (ch3 != "") {
                        wchartInstance.series[n + num].setData(eval(tc4));
                        num = num + 1;
                    }
                    //分析结果
                    griddata = data;
                    var max = 0;
                    var min = 0;
                    var sum = 0;
                    var pets = "";
                    var temp = 0;
                    var nums = 0;
                    var maxt = "";
                    var mint = "";
                    var sresult = "";
                    var snum = 0;
                    var result = "";
                    dtOpstart = $("#StartTime").datebox("getValue");
                    dtOpend = $("#EndTime").datebox("getValue");
                    num = 0;
                    if (ch0 != "") {

                        num = num + 1;
                        pets = pets + ch0;
                        max = 0;
                        sum = 0;
                        maxt = "";
                        mint = "";
                        snum = 0;
                        sresult = "";
                        $.each(data.rows, function (k, v) {
                            temp = parseInt(v["ch0"]);
                            if (temp >= max) { max = temp; maxt = v["updateTime"]; }
                            sum = sum + temp;
                        });
                        result = result + "其中" + ch0 + "，最大数为：" + max + ",发生日期是：" + maxt + "。";
                    }
                    if (ch1 != "") {
                        pets = pets + ch1;
                        num = num + 1;
                        max = 0;
                        sum = 0;
                        maxt = "";
                        mint = "";
                        snum = 0;
                        sresult = "";
                        $.each(data.rows, function (k, v) {
                            temp = parseInt(v["ch1"]);
                            if (temp >= max) { max = temp; maxt = v["updateTime"]; }
                            sum = sum + temp;
                        });
                        result = result + "其中" + ch1 + "，最大数为：" + max + ",发生日期是：" + maxt + "。";
                    }
                    if (ch2 != "") {
                        pets = pets + ch2;
                        num = num + 1;
                        max = 0;
                        sum = 0;
                        maxt = "";
                        mint = "";
                        snum = 0;
                        sresult = "";
                        $.each(data.rows, function (k, v) {
                            temp = parseInt(v["ch2"]);
                            if (temp >= max) { max = temp; maxt = v["updateTime"]; }
                            sum = sum + temp;
                        });
                        result = result + "其中" + ch2 + "，最大数为：" + max + ",发生日期是：" + maxt + "。";
                    }
                    if (ch3 != "") {
                        pets = pets + ch3;
                        num = num + 1;
                        max = 0;
                        sum = 0;
                        maxt = "";
                        mint = "";
                        snum = 0;
                        sresult = "";
                        $.each(data.rows, function (k, v) {
                            temp = parseInt(v["ch3"]);
                            if (temp >= max) { max = temp; maxt = v["updateTime"]; }
                            sum = sum + temp;
                        });
                        result = result + "其中" + ch3 + "，最大数为：" + max + ",发生日期是：" + maxt + "。";
                    }
                    if (dtOpstart != "") dtOpstart = dtOpstart + "到";
                    if (dtOpend != "") dtOpstart = dtOpstart + dtOpend;
                    result = dtOpstart + "，" + uid + "靶标害虫中害虫" + num + "种，分别为：" + pets + "。" + result;
                    $('#mmark').val(result);
                },
                pageList: [10, 20, 40, 50, 10000]
            });
        }
        
        function gethname(nodes) {
            var ids = "";
            for (var i = 0; i < nodes.length; i++)
                ids = ids + nodes[i].text + ",";
            if (ids != "")
                ids = ids.substr(0, ids.length - 1);
            return ids;

        }       
        var WChartJS = {
            init: function (chs) {
                var s = "[";
                $.each(chs, function () {
                    s = s + "{name:'" + this + "',data:[]},";
                });
                s = s.substr(0, s.length - 1);
                s = s + "]";
                wchartInstance = new Highcharts.Chart({
                    chart: {
                        renderTo: 'chartAreahz',
                        type: 'line'
                    },
                    credits: {
                        enabled: false
                    },
                    exporting: {
                        enabled: true
                    },
                    title: {
                        text: '',
                        x: -20 //center
                    },
                    xAxis: {
                        type: 'datetime',
                        labels: {
                            step: 1,
                            formatter: function () {
                                return new Date(this.value).toLocaleDateString();
                            }
                        }
                    },
                    yAxis: {
                        title: {
                            text: '数值'
                        },
                        plotLines: [{
                            value: 0,
                            width: 1,
                            color: '#808080'
                        }]
                    },
                    tooltip: {
                        formatter: function () {
                            return '<b>' + this.series.name + '：</b>' + this.y + '<br/> <b>时间：</b>' + new Date(this.x).toLocaleString();
                        }

                    },
                    legend: {
                        //layout: 'vertical',
                        align: 'center',
                        verticalAlign: 'top',
                        borderWidth: 0
                    },
                    series: eval(s)
                });
            }
        };
        function getids(nodes) {
            var ids = "";
            for (var i = 0; i < nodes.length; i++)
                ids = ids + nodes[i].id + ",";
            if (ids != "")
                ids = ids.substr(0, ids.length - 1);
            return ids;

        }
        function getQueryParamshz(queryParams) {
            var StartTime = $("#txtstart").datebox("getValue");
            var EndTime = $("#txtend").datebox("getValue");           
            var hnodes = $('#pt1').tree('getChecked');
            var jg = $("#jg").combobox('getValue');
            
            queryParams.sebm =sebm;
            
            if (hnodes.length != 0) {
                var idh = getids(hnodes);
                queryParams.idh = idh;
            }
            else {
                queryParams.idh = "";
            }
            var pids = getids(hnodes);
            
            queryParams.StartTime = StartTime;
            queryParams.EndTime = EndTime;
            queryParams.jg = jg;
            return queryParams;

        }
        function renderinfopic(getdata) {
            var html = template('tmppic', getdata);
            html = html + "<div style='clear: both;'></div>";
            $('#infos').html(html);
            $(".small_pic li").click(function () {
                $(this).siblings().removeClass("on");
                $(this).addClass("on");
                var preNumber = $(this).prevAll().size() + 1;
                $(".big_pic li").removeClass("on");
                $(".big_pic li:nth-child(" + preNumber + ")").addClass("on");
                picname = $(this).find("img").attr("alt");
                InitGird();
            });
            $(".small_pic li:eq(0)").addClass("on");
            $(".big_pic li:eq(0)").addClass("on");
            var elements = document.querySelectorAll('.demo-image');
            Intense(elements);
        }
        //增加查询参数，重新加载表格  
        function reloadgridhz(t) {
            var queryParams = $('#hzgrid').datagrid('options').queryParams;
            getQueryParamshz(queryParams);
            if (t == "1") {
                queryParams.action = "queryhcc";
                iscollect = "yes";
                $('#tt').datagrid({ pageSize: 1000 });
            }
            else {
                queryParams.action = "queryhc";
                iscollect = "";
            }
            $('#hzgrid').datagrid('options').queryParams = queryParams;
            $("#hzgrid").datagrid('reload');

        }
    </script>
     <script id="tmppic" type="text/html">
        <div class="sec bnspic">
	<div class="big_pic">
		<ul>

        {{each rows as value index}}
            <li><div class="demo-image" data-image="http://124.128.96.70:8012/sk_pic/{{value.ptstr}}" data-title="{{value.ptime}}" data-caption=""><img src="http://124.128.96.70:8012/sk_pic/{{value.ptstr}}"  /><span class="txt">{{value.ptime}}</span></div></li>
{{/each}} 
            </ul>
	</div>
	<div class="small_pic clearfix">
		<ul>
            {{each rows as value index}}
            <li><a href="#"><img src="http://124.128.96.70:8012/sk_pic/{{value.ptstr}}" alt="{{value.ptstr}}" /></a></li>
            {{/each}} 
  	</ul>
	</div>
</div>




        
    </script>
    <script id="tmpstations" type="text/html">
        {{each rows as value index}}
        <div class="stations">
            <div class="level1Div" onclick="showawsinfectInfo('{{value.DevID}}')">
                <div class="levelsb">{{value.devname}}</div>
                <div class="leveltime">时间：{{value.mdatetime}} 已运行{{value.days}}天</div>
                <div class="levelbottom">
                    <div class="levelpet">最后上传时间：{{value.updateTime}}</div>  
                </div>
            </div>
        </div>
        {{/each}} 
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div id="mainDiv">
        <uc1:checkright runat="server" ID="checkright" />
        <uc1:spet runat="server" ID="spet" />
        <div>
            <div id="contentDiv">
                <div class="mypt">
                    <ul id="pt"></ul>
                </div>
                <div id="mycontent">
                    <div id="tab" class="easyui-tabs">
                        <div title="GSI" style="padding: 5px;">

                            <div style="position: relative;">
                            <div id="mymap"></div>
                            <div id="Maptype" style="height: 87px; width: 130px; position: absolute; float: left; margin-left: 850px; top: 50px; z-index: 99; color: Black; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px;">
                                <input id="CBstationname" onclick="ShowstationName('checkbox')" checked="checked" style="float: left; margin-left: 10px;"
                                    type="checkbox" />
                                <label onclick="ShowstationName('label')" style="height: 20px; width: 100px; float: left; text-align: left; font-size: 13px; font-family: 宋体; font-weight: bold; margin-top: 3px; cursor: pointer;">
                                    显示名称</label>
                            </div>
                        </div>
                        </div>
                        <div title="设备列表" style="overflow: auto; padding: 5px;">
                            <div id="mystations"></div>
                        </div>                        
                    </div>
                </div>
            </div>
            <uc1:copyright runat="server" ID="copyright" />
            
        </div>
    </div>
    
</asp:Content>
